local M = {
	events = {
		--[key] = {
		--	[listener] = {
		--		listener = listener,
		--		isInvalid = isInvalid
		--	},
		--}
	}
}

function M:addEventListener(key, listener, isInvalid)
	M.events[key] = M.events[key] or {}
	M.events[key][listener] = {
		--listener = listener,
		isInvalid = isInvalid
	}
end

function M:dispatchEvent(key, params)
	if not M.events[key] then

		return
	end

	for listener, v in pairs(M.events[key]) do
		if v.isInvalid and v.isInvalid() then
			M.removeEvent(key, listener)
		else
			listener(params)
		end
	end
end

function M:removeEvent(key, listener)
	if not M.events[key] then
		return
	end

	M.events[key][listener] = nil
end

local tInfo = {
	chooseObj = "舞台组选中了某个对象",
	clickHieObj = "层级面板点击了某个物体",
	chooseObjMove = "选中的物体发生移动",
	mouseOnNewObject = "鼠标选中新物体",
	hierDragRelease = "hier面板拖动调整物体",
	changeParentDelete = "从原有层级中删除",
	changeParentAdd = "添加到新的层级中",
	compRelease = "放开组件",
}

return M